/*
 * FileTAR.h
 *
 * Zdroj adresara: TAR
 *
 *  Created on: 1.4.2011
 *      Author: Petr Hodac, Tomas Hlavnicka
 */

#ifndef FILETAR_H_
#define FILETAR_H_

#include <iostream>
#include <cstdio>
#include <cerrno>
#include <string>
#include "IFile.h"
#include <libtar.h>
#include <fcntl.h>
#include <cstring>
#include <cstdlib>

class FileTAR : public IFile
{
private:
	std::string source;
	TAR * tar;
	char cache[T_BLOCKSIZE];
	int coff, cend;
	bool _eof;
	unsigned int fsize;
public:
	FileTAR(std::string source);
	void open(const char * filename, const char * mode);
	int read(void * buf, int len);
	int write(const void * buf, int len);
	bool eof();
	void close();
	std::string type() const;
	virtual ~FileTAR();
};

#endif /* FILETAR_H_ */
